// -----------------------------------------------------------------------
//  <copyright file="ServicesExtensions.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2022 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2022-12-25 18:28</last-date>
// -----------------------------------------------------------------------

using DaprPlus.Extensions;
using DaprPlus.Net;
using DaprPlus.Security;

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

using Shares.Infrastructure.Net;
using Shares.Infrastructure.Security;


namespace Shares.Infrastructure;

public static class ServicesExtensions
{
    /// <summary>
    /// 添加验证码服务
    /// </summary>
    public static IServiceCollection AddCaptchaService(this IServiceCollection services)
    {
        services.AddCaptcha();
        services.AddScoped<ICaptchaService, CaptchaService>();
        return services;
    }

    /// <summary>
    /// 添加MailKit邮件发送器
    /// </summary>
    public static void AddMailKitEmailSender(this IServiceCollection services)
    {
        services.Configure<SmtpOptions>(SmtpOptions.Position);
        services.TryAddTransient<IEmailSender, MailKitEmailSender>();
    }
}
